﻿using UnityEngine;
using System.Collections;

public class PointInDirectionOfMotion : MonoBehaviour 
{
    public Vector3 ModelUp = Vector3.up;
    public float TurnToFaceSpeed = .1f;

    Vector3 lastPos;

    Vector3 dir { get { return Vector3.Normalize(transform.position - lastPos); } }

	// Use this for initialization
	void Start () 
    {
        lastPos = transform.position;
	}
	
	// Update is called once per frame
	void Update () 
    {
        transform.rotation = HelperClass.LookAt(transform.position + dir, TurnToFaceSpeed, transform.position, transform.rotation, ModelUp);

        lastPos = transform.position;
	}
}
